{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d413e508",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import seaborn as sns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d29098e2",
   "metadata": {},
   "outputs": [],
   "source": [
    "comment_res_df = pd.read_csv(\"Spark/data/mllib/data/commentRes/part-00000-f84ddf06-2590-430b-be79-91908f21fbce-c000.csv\",names=[\"comment_id\",\"comment_text\",\"sentence\",\"prediction\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "367ccc3d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>comment_id</th>\n",
       "      <th>comment_text</th>\n",
       "      <th>sentence</th>\n",
       "      <th>prediction</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>4695502736851918</td>\n",
       "      <td>但美国没封锁呀</td>\n",
       "      <td>美国 没 封锁</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4695507152144658</td>\n",
       "      <td>参考DOI：10.1101/2021.08.10.21261846</td>\n",
       "      <td>参考 doi 10.1101 2021.08.10.21261846</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4695503973387448</td>\n",
       "      <td>扯了个蛋，疫情期间出生的孩子测智商？才多大啊，真当测智商像测血常规那样的啊</td>\n",
       "      <td>扯 蛋 疫情 期间 出生 孩子 测智商 多大 真 测智商 测 血常规</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4695503130329772</td>\n",
       "      <td>多接触自然</td>\n",
       "      <td>接触 自然</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4695545044537182</td>\n",
       "      <td>可笑，诋毁中国方案已经无所不用其极。</td>\n",
       "      <td>可笑 诋毁 中国 方案 已经 无所不用其极</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         comment_id                           comment_text  \\\n",
       "0  4695502736851918                                但美国没封锁呀   \n",
       "1  4695507152144658      参考DOI：10.1101/2021.08.10.21261846   \n",
       "2  4695503973387448  扯了个蛋，疫情期间出生的孩子测智商？才多大啊，真当测智商像测血常规那样的啊   \n",
       "3  4695503130329772                                  多接触自然   \n",
       "4  4695545044537182                     可笑，诋毁中国方案已经无所不用其极。   \n",
       "\n",
       "                             sentence  prediction  \n",
       "0                             美国 没 封锁         0.0  \n",
       "1  参考 doi 10.1101 2021.08.10.21261846         0.0  \n",
       "2  扯 蛋 疫情 期间 出生 孩子 测智商 多大 真 测智商 测 血常规         0.0  \n",
       "3                               接触 自然         1.0  \n",
       "4               可笑 诋毁 中国 方案 已经 无所不用其极         0.0  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "comment_res_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "99b20281",
   "metadata": {},
   "outputs": [],
   "source": [
    "preCnt = comment_res_df.groupby('prediction')['comment_id'].count().reset_index().rename(columns={'comment_id':\"cnt\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "53653f1a",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "86f49206",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOcAAADnCAYAAADl9EEgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAT2klEQVR4nO3deZQdZZnH8e/bS/aks+/ptBADFAmQAEEIhCZ4jkeOHgdkvHjUGneghBnHKzrjzJwRBnUWehwZrbDIVhLGVhBERkAGSAhhMYEExAJCTJBEVgNNCAlZut/5owptQjrp5d563rr1fM65hwSbfn5qfrzVdeu+r7HWopRyT510AKXUvmk5lXKUllMpR2k5lXKUllMpR2k5lXKUllMpR2k5lXKUllMpR2k5lXKUllMpR2k5lXKUllMpR2k5lXKUllMpR2k5lXKUllMpR2k5lXKUllMpR2k5lXKUllMpR2k5lXKUllMpR2k5lXJUYctpjGkxxjxljFlqjHnSGHOjMWaYMeZUY8waY8xvjDFXG2MGp1//r8aY2BjzuDHmEun8qvaZou74boxpATYCJ1prVxpjrgY2AGcDp1pr1xljIuBR4EfAA8Ch1lprjBltre0Qiq4KorArZ2qTtXZl+uvrgVOBjdbadenfuw5YBLwOvAVcZYw5A9ieeVJVOA3SAYTtfdnQAYx71xdZu8cYs4CkvGcC5wGLq54OiAO/CTg0fc1O8w0BhqZ/HdLD7xuArcCr6WtL+noR2NTt9bwXRruz+O+i+kYva+EEa+2Dxpgfpr8/G1hsrV1vjLkWWANcBQyz1r5sjGkCNlhr31Xi/ooD3wDN/LmE3V+TKzWnB13As8CvgYfS1xovjHZVea46gKKX8w5gNXA0EAOfAo4HLiFZeVYB5wJjgZ+TrEgGuMRae91A5seBPwv4YPpaBAwfyPersJ0k/1J6u6wPeWH0e9lIxVP0ct5mrZ2Txbw48IcCrfy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t7UNICjqD5HjD7q+pwEhgaPoaxruLvJukdNvTv24FNu/j9Rzwu2ofyW6MaQFuJzlP9QSSx/c+AnyS5O2oQSSfSvmUtXa7MeZgYCkwHPg58GVr7YhqZnSNlrNG+G3tjSRFtcD2apetr9JyrgeOsdauNcb8BLgVuN1auyX9mouBl6y1/22MuQ1Yaq39H2PMOcAlWk6lqiAt513W2vemv/86yfYwK4CLgdHACOBOa+05xpgtwCRr7R5jzCjg+aKVUz/PqbK0s9uvO4EGkkOnzrPWziXZAWGIQC4naTmVtJHAC8aYRuAT3f7+Q8BH01+flXkqB2g5lbR/Ah4GVgLd96T9MvAVY8zjJDfGXs8+miz9mVM5yRgzDNhhrbXGmLOAj1trPyKdK0sN0gGU6sHRwPdNcq5qB/BZ2TjZ05VTKUfpz5xKOUrLqZSjtJxKOUrLqZSjtJxKOUrLqZSjtJxKOUrLqZSjtJxKOUrLqZSjtJxKOUrLqZSjtJxKOUrLqZSjtJxKOUrLqZSjtJxKOUrLqZSjtJxKOUrLqZSjtJxKOer/ASQ/SFaQHhBgAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.pie(preCnt[\"cnt\"],labels=['pos','nag'],\n",
    "        colors=[\"#d5695d\", \"#5d8ca8\"])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e1556df1",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
